package riceSystem.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import riceSystem.dao.DaoTemplateInterface;
import riceSystem.entity.Province;
import riceSystem.exception.RunException;
import riceSystem.service.ServiceTemplateInterface;
@Component("provinceService")
public class ProvinceServiceImpl implements ServiceTemplateInterface<Province> {
	
	private DaoTemplateInterface<Province> provinceDao;
	
	public DaoTemplateInterface<Province> getProvinceDao() {
		return provinceDao;
	}
	@Resource(name="provinceDao")
	public void setProvinceDao(DaoTemplateInterface<Province> provinceDao) {
		this.provinceDao = provinceDao;
	}

	public void add(Province t) throws RunException {
		provinceDao.save(t);
	}

	public void removeById(long id) throws RunException {
		provinceDao.deleteById(id);
	}

	public void remove(Province t) throws RunException {
		provinceDao.delete(t);
	}

	public long update(Province t) throws RunException {
		return provinceDao.update(t);
	}

	public Province getById(long id) throws RunException {
		return provinceDao.loadById(id);
	}

	public List<Province> getAll() throws RunException {
		return provinceDao.loadAll();
	}

}
